Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep discriminator errors relevant #533

Merged
merged 1 commit into from
May 2, 2023
Merged

Conversation

zorbash
Copy link
Contributor

@zorbash zorbash commented Apr 10, 2023

Addresses: #522

When we attempt to cast polymorphic (oneOf, anyOf) schemas and a discriminator is provided, we should be casting only the schema specified by the discriminator and any error messages should be related to that schema.

It's unclear if there is a use case for discriminator in conjunction with allOf but since the spec clearly states

allOf - validates the value against all the subschemas

that the input value must be validated against all the schemas, for allOf this PR preserves the existing behaviour.

@zorbash zorbash requested a review from mbuhot April 12, 2023 16:09
@zorbash zorbash merged commit 72f9e88 into master May 2, 2023
@zorbash zorbash deleted the fix-discriminator-errors branch May 2, 2023 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant